<template>
	<view class="layout">
		<!-- 总资产 -->
		<view class="priceBox">
			<view class="tit">总资产(CNY)</view>
			<view class="money">{{amount}}</view>
			<view class="btn">
				<view class="recharge" @click="recharge">充值</view>
				<view class="cash" @click="cashLink">提现</view>
			</view>
		</view>
		<!-- 明细 -->
		<view class="listBox">
			<view class="tit">明细</view>
			<view class="list">
				<view v-if="log.length<1 " class="empty">
					<image src="/static/nodata.jpg" mode="aspectFit"></image>
					<view class="empty-tips">
						空空如也
					</view>
				</view>
				
				<view class="rows" v-for="(row,index) in log" :key='index'>
					<view class="row">
						<view class="rowTit">{{row.note}}</view>
						<view class="price" v-if="row.isOk">{{row.mark}}{{row.amount}}</view>
						<view class="price income" v-else>{{row.mark}}{{row.amount}}</view>
					</view>
					<view class="row">
						<view class="info">{{row.info}}</view>
						<view class="time">{{row.add_time}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex';
	export default {
		data() {
			return {
				log:[],
				amount:0.00
			};
		},
		computed: {
			...mapState(['hasLogin','userInfo'])
		},
		onLoad() {
			var that = this
			var _param = {
				token:this.userInfo.token
			}
			/* this.$api.postUrl(this.$api._api.ApiSellerWallet, _param, function(res){
				let _data = {};
				if(typeof(res.data) == "object"){
					_data = res.data;
				}else{
					_data = JSON.parse(res.data);
				}
				if(_data.status == 1){
					that.log = _data.data.log
					that.amount = _data.data.amount
				}
			}) */
		},
		methods: {
			cashLink:function(e){
				uni.showModal({
					title:'提示',
					content:'功能开发中，敬请期待！',
					showCancel:false
				})
				// uni.navigateTo({
				// 	url:'../cash/cash'
				// })
			},
			recharge:function(e){
				uni.showModal({
					title:'提示',
					content:'功能开发中，敬请期待！',
					showCancel:false
				})
				// uni.navigateTo({
				// 	url:'../recharge/recharge'
				// })
			}
		},
	};
</script>

<style lang="scss">
	.empty{
		// position:fixed;
		// left: 0;
		// top:0;
		width: 100%;
		// height: 100vh;
		padding:150rpx 0;
		display:flex;
		justify-content: center;
		flex-direction: column;
		align-items:center;
		background: #fff;
		image{
			width: 240rpx;
			height: 160rpx;
			margin-bottom:30rpx;
		}
		.empty-tips{
			display:flex;
			font-size: $font-sm+2rpx;
			color: $font-color-disabled;
			.navigator{
				color: $uni-color-primary;
				margin-left: 16rpx;
			}
		}
	}
	// 总资产
	.priceBox{
		margin: 30rpx;background:linear-gradient(to right,#fa436a,#fa9943);
		padding:50rpx 40rpx 40rpx 40rpx;border-radius:20rpx;color:#fff;
		text-align: center;
		.tit{font-size: 30rpx;}
		.money{font-size:65rpx;font-weight: bold;margin-top:20rpx;}
		.btn{
			margin-top:40rpx;display: flex;justify-content: center;
			.cash,.recharge{border-radius: 50rpx;color:#fff;font-size: 26rpx;
			border: 2rpx solid #fff;width:160rpx;height:55rpx;line-height:55rpx;margin: 0 20rpx;}
		}
	}
	// 明细
	.listBox{
		margin: 0 30rpx;
		.tit{font-size:32rpx;border-left:6rpx solid #fa436a;height:35rpx;line-height:35rpx;padding-left:10rpx;margin-bottom:30rpx;}
		.rows{
			background:#fff;margin-bottom: 20rpx;padding:25rpx;border-radius:10rpx;
			.row{
				display: flex;align-items: center;
				.rowTit,.info{flex: 1;}
				.rowTit,.price{font-size: 30rpx;font-weight: bold;}
				.price{color:#fa436a;font-size: 35rpx;}
				.info,.time{font-size:26rpx;color:#999;margin-top:10rpx;}
				.income{color:#19d538;}
			}
		}
	}
</style>
